package cn.remexs.flink.udf.json;

import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import org.apache.flink.table.functions.ScalarFunction;


public class PickByField extends ScalarFunction {
    public PickByField() {
    }

    public String eval(String json, String field) {

        try {
            JSONObject jsonObject = JSONUtil.parseObj(json);
            return jsonObject.getStr(field);
        } catch (Exception e) {
            return null;
        }
    }
}
